/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.orderoid.ejb.domain;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Dahlia
 */
@Entity
@Table(name = "type_produit")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TypeProduit.findAll", query = "SELECT t FROM TypeProduit t"),
    @NamedQuery(name = "TypeProduit.findByIdType", query = "SELECT t FROM TypeProduit t WHERE t.idType = :idType"),
    @NamedQuery(name = "TypeProduit.findByLibelle", query = "SELECT t FROM TypeProduit t WHERE t.libelle = :libelle")})
public class TypeProduit implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_type")
    private Integer idType;
    @Size(max = 255)
    @Column(name = "libelle")
    private String libelle;

    public TypeProduit() {
    }

    public TypeProduit(Integer idType) {
        this.idType = idType;
    }

    public Integer getIdType() {
        return idType;
    }

    public void setIdType(Integer idType) {
        this.idType = idType;
    }

    public String getLibelle() {
        return libelle;
    }

    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idType != null ? idType.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TypeProduit)) {
            return false;
        }
        TypeProduit other = (TypeProduit) object;
        if ((this.idType == null && other.idType != null) || (this.idType != null && !this.idType.equals(other.idType))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return libelle;
    }
    
}
